import { Nagget, NaggetPiece } from './NaggetPiece';
import * as React from 'react';
import { Component } from 'react';

export interface NaggetCardProps {
	_id: string;
	content: Array<Nagget>
	username: string;
	postTime: string;
}

export class NaggetCard extends Component<NaggetCardProps, any> {
	constructor(props: NaggetCardProps) {
		super(props);
	}

	public render() {
		let pieces: Array<any> = [];
		this.props.content.forEach(it => {
			pieces.push(<NaggetPiece type={it.type} content={it.content} />);
		});
		return (
			<div className={"nagget-card"}>
				{pieces}
			</div>
		);
	}
}
